import java.util.Scanner;     //实现从键盘输入需要引用Scanner类
class Person{         //创建Person类，含name,age,gender,id属性
	private String name = null;
	private int age = 0;
	private boolean gender = false;
	private int id = 0;
	
	public Person() {      //创建无参构造函数
		System.out.println("This is constructor");
		System.out.println(name+","+age+","+gender+","+id);
		System.out.println("Person [name="+name+", age="+age+", gender="+gender+", id="+id+"]");
	}
	
	public Person(String n, int a, boolean g) {    //创建有参构造函数
		this.name = n;
		this.age = a;
		this.gender = g;
	}
		public String getName(){       //定义setter/getter方法
		 return name;
	 }
	 public void setName(String name){
		 this.name=name;
	 }
	 public int getAge(){
		 return age;
	 }
	 public void setAge(int age){
		 this.age=age;
	 }
	 public boolean getGender(){
		 return gender;
	 }
	 public void setGender(boolean gender){
		 this.gender=gender;
	 }
	 public int getId(){
		 return id;
	 }
	 public void setId(int id){
		 this.id=id;
	 }
	public String toString() {     //覆盖toString函数
		System.out.println("Person [name="+this.name+", age="+this.age+", gender="+this.gender+", id="+0+"]");
		return name;
	}
}

public class Five {

	public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		int n = reader.nextInt();         //从键盘读取n,代表输入对象的个数
		Person[] per = new Person[n];	  //初始化对象数组
		for(int i=0; i<per.length; i++) {	 //循环从键盘输入
			String name = reader.next();
			int age = reader.nextInt();
			boolean genter = reader.nextBoolean();
			per[i] = new Person(name,age,genter);
		}
		for(int x=per.length-1; x>=0;x--){	  //通过循环逆序输出
			per[x].toString();
		}
		
		per.toString();
		Person person = new Person();    //新建person对象并实例化
	}
}
